{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "36f5d04f-b456-4e65-91a8-482c91f854c1",
   "metadata": {},
   "source": [
    "## Offline server"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "86924e3b-d7dc-46e1-a9f4-05c8abee4da8",
   "metadata": {},
   "outputs": [],
   "source": [
    "!lsof -i :8815\n",
    "# !kill -9 64859 98087"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "73b219c3-7782-4e09-9897-d01f44ccae2d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from feast import FeatureStore\n",
    "store = FeatureStore(repo_path=\"rbac/feature_repo\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "75967678-0573-410e-b9dd-09743b67eac3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import logging\n",
    "import sys\n",
    "from io import StringIO\n",
    "logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s')\n",
    "logger = logging.getLogger() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5400ee1b-de0a-4fe9-9003-83d0af0863e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "store.serve_offline(\"localhost\", 8815)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8b822d5c-41d9-477a-8b42-c4701784bac2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Run this in case it's needed to force materialize from offline server\n",
    "from datetime import datetime\n",
    "store.materialize_incremental(end_date=datetime.now())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ff854a14-4649-4d40-94fa-b6e2b8577afa",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
